package com.file.system.entity.system;


import com.file.system.entity.basic.WebBasic;
import com.file.system.plugin.dict.Dict;
import com.file.system.plugin.validated.SQLInjectionValidation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.groups.Default;
import java.io.Serializable;
import java.util.List;


/**
 * 角色数据权限
 *
 * @author jch
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class WebRoleData extends WebBasic implements Serializable {

    private static final long serialVersionUID = 1L;


    //新增
    public interface select extends Default {
    }

    //修改
    public interface update extends Default {
    }

    /**
     * 主键
     */
    @Min(value = 1, message = "id长度最小1")
    private Long id;
    /**
     * 编码
     */
    @NotEmpty(groups = {update.class, select.class}, message = "编码不能为空")
    @Size(min = 1, max = 100, message = "编码长度1-100")
    @SQLInjectionValidation(fieldName = "编码")
    private String code;
    /**
     * 数据范围（字典）
     */
    @NotEmpty(groups = {update.class}, message = "数据范围不能为空")
    @Size(min = 1, max = 100, message = "数据范围长度1-100")
    @Dict("dataRange")
    @SQLInjectionValidation(fieldName = "数据范围")
    private String dictDataRange;
    /**
     * 角色id
     */
    @NotNull(groups = {select.class, update.class}, message = "角色id不能为空")
    @Min(value = 1, message = "角色id最小1")
    private Long fkRoleId;
    /**
     * 树节点id
     */
    private List<WebRoleNode> nodeList;
}
